﻿
<section class="content-header">
    <h1>
        评论管理
    </h1>
    <ol class="breadcrumb">
        <li><a href="@Url.Action("Index", "Home")"><i class="fa fa-home"></i> 首页</a></li>
        <li class="active">VIU</li>
    </ol>
</section>

<section class="content">
    <div class="row">
        <div class="col-lg-12">
            <div class="box box-primary">
                <div class="box-header with-border">
                    <div class="dataTable-tools btn-group">
                        @Html.Bootstrap().LinkButton("审核", ToolBarIco.Checkin).Style().Primary()
                        @Html.Bootstrap().LinkButton("删除", ToolBarIco.Delete).Click("window.app.deleteItem('dataList','" + @Url.Action("Delete") + "')").Route(Url.Action("Delete"))
                        @Html.Bootstrap().LinkButton("刷新", ToolBarIco.Refresh).Click("window.app.search();")
                    </div>
                    <div class="box-tools SearchArea">
                        <div class="btn-group btn-group-xs pull-left" style="margin-right:6px;" data-toggle="buttons">
                            <label class="btn btn-default"><input type="radio" class="toggle" name="isPass" value="" />全部</label>
                            <label class="btn btn-default"><input type="radio" class="toggle" name="isPass" value="true" />已审核</label>
                            <label class="btn btn-default"><input type="radio" class="toggle" name="isPass" value="false" />未审核</label>
                        </div>
                        <div class="input-group input-group-sm  pull-right" style="width: 150px;">
                            <input type="text" name="Title" class="form-control pull-right" placeholder="搜索">

                            <div class="input-group-btn">
                                <button type="button" class="btn btn-default" onclick="window.app.search();"><i class="fa fa-search"></i></button>
                            </div>
                        </div>
                    </div>
                    <div class="box-body no-padding">
                        <div class="table-responsive">
                            <table id="dataList" class="table table-bordered table-striped table-hover dataTable text-center" width="100%"></table>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</section>

<script type="text/javascript">
    $(document).ready(function () {

        $('#dataList')
            .dataTable({
                "serverSide": true,
                "ajax": {
                    "url": "@Url.Action("GetPaged")",
                    "type": "POST"
                },
                "columnDefs": [
                    { "searchable": false, sortable: false, "orderable": false, "targets": [-1, 0, 1, 2] },
                    { "sClass": "editableCol", "aTargets": [1] }
                ],
                columns: [
                    {
                        title: '<label class="checkbox i-checks"><input type="checkbox" /><i></i></label>',
                        data: function(row, type, set) {
                            return '<label class="checkbox i-checks"><input type="checkbox" name="cellCheckbox" value="' + row.id + '" /><i></i></label>';
                        },
                        "bStorable": false,
                        width: 30
                    },
                    { title: "评论内容", data: 'content', "sClass": "left" },
                    {
                        title: "匿名",
                        data: function(row) {
                            return row.isAnonymous
                                ? "<span class=\"label label-danger\">是</span>"
                                : "<span class=\"label label-success\">否</span>";
                        },
                        width: 30,
                        "sClass": "center"
                    },
                    { title: "评论对象", data: function(row) {
                        return row.viu ? row.viu.title : '';
                    }, "sClass": "left" },
                    {
                        title: "评论会员",
                        data: function(row) {
                            return (row.userName || '') +
                                "<br />" +
                                (row.ip || '') +
                                "<br />" +
                                new Date(row.createTime).format('MM-dd HH:mm:ss');
                        },
                        width: 120,
                        "sClass": "left"
                    },
                    {
                        title: "状态",
                        data: function(row) {
                            return row.isPass
                                ? "<span class=\"label label-success\">已审核</span>"
                                : "<span class=\"label label-danger\">未审核</span>";
                        },
                        width: 30,
                        "sClass": "center"
                    }
                ]
            });
    });
</script>
